package com.wlw.admin.openeye.ui.fragment

import android.content.Intent
import android.view.View
import com.wlw.admin.openeye.R
import com.wlw.admin.openeye.base.BaseFragment
import com.wlw.admin.openeye.showToast
import com.wlw.admin.openeye.ui.activity.ProfileHomePageActivity
import com.wlw.admin.openeye.ui.activity.WatchHistoryActivity
import com.wlw.admin.openeye.utils.StatusBarUtil
import kotlinx.android.synthetic.main.fragment_mine.*

class MineFragment : BaseFragment(), View.OnClickListener {
    companion object {
        fun getInstance() = MineFragment()
    }

    override fun getLayoutId(): Int = R.layout.fragment_mine

    override fun lazyLoad() {
    }

    override fun initView() {
        activity?.let {
            StatusBarUtil.darkMode(it)
            StatusBarUtil.setPaddingSmart(it, toolbar)
        }

        tv_view_homepage.setOnClickListener(this)
        iv_avatar.setOnClickListener(this)
        iv_about.setOnClickListener(this)
        tv_collection.setOnClickListener(this)
        tv_commit.setOnClickListener(this)
        tv_mine_message.setOnClickListener(this)
        tv_mine_attention.setOnClickListener(this)
        tv_mine_cache.setOnClickListener(this)
        tv_watch_history.setOnClickListener(this)
        tv_feedback.setOnClickListener(this)
    }

    override fun onClick(p0: View?) {
        when (p0?.id) {
            R.id.iv_avatar -> {
             startActivity(Intent(activity, ProfileHomePageActivity::class.java))
            }
            R.id.tv_view_homepage -> {
                startActivity(Intent(activity, ProfileHomePageActivity::class.java))
            }
            R.id.iv_about -> {
                startActivity(Intent(activity, ProfileHomePageActivity::class.java))
            }
            R.id.tv_collection -> showToast("收藏")
            R.id.tv_commit -> showToast("评论")
            R.id.tv_mine_message -> showToast("我的消息")
            R.id.tv_mine_attention -> showToast("我的关注")
            R.id.tv_mine_cache -> showToast("我的缓存")
            R.id.tv_watch_history -> startActivity(Intent(activity, WatchHistoryActivity::class.java))
            R.id.tv_feedback -> showToast("意见反馈")

            else -> {
            }
        }
    }
}